﻿<!DOCTYPE html>
<html lang="zh-cn">
	<head>
		<title>导出密钥</title>
		<link rel="stylesheet" type="text/css" href="/sidebar.css" />
		<link rel="stylesheet" type="text/css" href="/pure-min.css" />
		<script src="js-yaml.min.js"></script>
		<script src="hashes.min.js"></script>
		<script src="openpgp.min.js"></script>
		<script src="FileSaver.min.js"></script>
		<script src="key.util.js"></script>
		<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
		<script>
			window.onload = init;
			function init() {
				var xmlhttp = getkey("");
				var httpres = document.getElementById("httpres");
				
				if(xmlhttp.status == 200){
					keyinfo = jsyaml.safeLoad(xmlhttp.responseText);
					
					var keyyaml = new Blob([xmlhttp.responseText], {type: "text/plain;charset=utf-8"});
					saveAs(keyyaml,"nor."+keyinfo.id+".keyinfo");
					httpres.innerHTML = "密钥导出成功<br\><br\>文件名:nor."+keyinfo.id+".keyinfo<br\>请记录保存路径，以免遗忘。" + "<a href=\"huangyg@mars22.com.keyinfo\" download=\"nor.keyinfo\" >keyinfo<\a>";
				}else{
					httpres.innerHTML = "密钥导出失败<br\><br\>xmlhttp.status:<br\>"+xmlhttp.status+"<br\><br\>xmlhttp.responseText:<br\>"+xmlhttp.responseText;
				}
			}
			
			
 		</script>
	</head>
	<body>
	<!--content begin-->
		<div class="header" align="center">
			<h1>导出密钥</h1>
			<h2>密钥托管范例</h2>
			<hr>
		</div>
		<p id="httpres">httpres
		</p>
	<!--content end-->
		<div class="nav">
			<div class="home">
			  <span><img src="favicon.ico"></img></span>
			</div>

			<div class="sidebar">
				<ul>
					<li onclick="window.location.href='welcome.html'">Home</li>
					<li class="devider"></li>
					<li onclick="window.location.href='create.html'">创建密钥</li>
					<li onclick="window.location.href='getkey.html'">获取密钥</li>
					<li class="devider"></li>
					<li onclick="window.location.href='update.html'">修改口令</li>
					<li class="devider"></li>
					<li onclick="window.location.href='exportkey.html'">导出密钥</li>
					<li onclick="window.location.href='importkey.html'">导入密钥</li>
					<li class="devider"></li>
					<li onclick="window.open('https://github.com/hyg/js.sample/blob/master/pgpage/README.md')">使用说明</li>
					<li onclick="window.open('http://git.oschina.net/hyg/js.sample/issues')">质量反馈</li>
				</ul>
			</div>
		</div>
	</body>
</html>